﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace System
{
    /// <summary>
    /// 通用调试方法
    /// </summary>
    public static class TongTestExpand
    {

        /// <summary>
        /// 测试此方法运行时间
        /// </summary>
        /// <param name="act">运行方法</param>
        /// <returns>返回时间单位毫秒</returns>
        public static long StopwatchRun(this Action act)
        {
            System.Diagnostics.Stopwatch sa = new System.Diagnostics.Stopwatch();
            long result = 0;
            sa.Restart();

            try
            {
                act();
            }
            finally
            {

                sa.Stop();
                result = sa.ElapsedMilliseconds;
            }
            return result;
        }

    }
}